﻿using System;
using System.Collections.Generic;
using System.Reflection;
using NETDeob.Core.Engine;

namespace NETDeob.Core.Deobfuscators.Confuser._1_9
{
    class Anti_Debug :IRoutine  
    {
        public string Description
        {
            get { return "Remove Anti-Debug Confusion"; }
        }

        public Dictionary<Func<bool>, string> Phases
        {
            get
            {
                return new Dictionary<Func<Boolean>,String>
                {
                    {Phase1, "Detect Anti-Debug Confusion"}
                };
            }
        }

        private Boolean Phase1()
        {
            try
            {
                var mainModule = Settings.TargetAssemblyDef.Modules[0];
                var moduleType = mainModule.Types[0]; // <Module>

                if (moduleType.HasMethods)
                {
                    var ctor = moduleType.Methods[0];


                    // TODO:DETECT INSTRUCTION
                }

                return true;
            }
            catch (Exception exception)
            {
                Logger.Log(exception.Message, 1);
                return false;
            }
        }
    }
}
